/* eslint valid-jsdoc: "off" */

'use strict';
const path = require('path')
/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1666660734521_8983';

  // add your middleware config here
  config.middleware = [];

  // 修改安全策略
  config.security = {
    csrf: {
      enable: false
    },
    domainWhiteList: ['*']
  }

  // 文件处理
  config.multipart = {
    // 模式 
    mode: 'file',
    // 保存怒目
    // tmpdir: path.resolve(__dirname, '../app/static'),
    // 可以上传的文件
    whitelist: [
      // images
      '.jpg', '.jpeg', // image/jpeg
      '.png', // image/png, image/x-png
      '.gif', // image/gif
      '.bmp', // image/bmp
      '.wbmp', // image/vnd.wap.wbmp
      '.webp',
      '.tif',
      '.psd',
      // text
      '.svg',
      '.js', '.jsx',
      '.json',
      '.css', '.less',
      '.html', '.htm',
      '.xml',
      // tar
      '.zip',
      '.gz', '.tgz', '.gzip',
      // video
      '.mp3',
      '.mp4',
      '.avi',
    ],
    // 扩展
    fileExtensions: [
      // 额外的上传的文件
      '.avif',
      ".xlsx"
    ],
  }

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  return {
    ...config,
    ...userConfig,
  };
};
